home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Events.a < prev    next >
Encoding:
Text File  |  1996-05-04  |  8.7 KB  |  378 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2.1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  21. __EVENTS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  30.     include 'Quickdraw.a'
  31.     ENDIF
  32. ;        include 'MixedMode.a'                                        ;
  33. ;        include 'QuickdrawText.a'                                    ;
  34.  
  35.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  36.     include 'OSUtils.a'
  37.     ENDIF
  38. ;        include 'Memory.a'                                            ;
  39. ; typedef UInt16             EventKind
  40.  
  41. nullEvent                        EQU        0
  42. mouseDown                        EQU        1
  43. mouseUp                            EQU        2
  44. keyDown                            EQU        3
  45. keyUp                            EQU        4
  46. autoKey                            EQU        5
  47. updateEvt                        EQU        6
  48. diskEvt                            EQU        7
  49. activateEvt                        EQU        8
  50. kHighLevelEvent                    EQU        23
  51.  
  52. ; typedef UInt16             EventMask
  53.  
  54. mDownMask                        EQU        $0002                ; mouse button pressed 
  55. mUpMask                            EQU        $0004                ; mouse button released 
  56. keyDownMask                        EQU        $0008                ; key pressed 
  57. keyUpMask                        EQU        $0010                ; key released 
  58. autoKeyMask                        EQU        $0020                ; key repeatedly held down 
  59. updateMask                        EQU        $0040                ; window needs updating 
  60. diskMask                        EQU        $0080                ; disk inserted 
  61. activMask                        EQU        $0100                ; activate/deactivate window 
  62. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents) 
  63. osMask                            EQU        $8000                ; operating system events (suspend, resume) 
  64. everyEvent                        EQU        $FFFF                ; all of the above 
  65.  
  66. ; event message equates 
  67. charCodeMask                    EQU        $000000FF
  68. keyCodeMask                        EQU        $0000FF00
  69. adbAddrMask                        EQU        $00FF0000
  70. osEvtMessageMask                EQU        $FF000000
  71. ; OS event messages.  Event (sub)code is in the high byte of the message field. 
  72. mouseMovedMessage                EQU        $00FA
  73. suspendResumeMessage            EQU        $0001
  74. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend 
  75. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change 
  76.  
  77. ; typedef UInt16             EventModifiers
  78.  
  79. ; modifiers 
  80. activeFlag                        EQU        $0001                ; Bit 0 of modifiers for activateEvt and mouseDown events 
  81. btnState                        EQU        $0080                ; Bit 7 of low byte is mouse button state 
  82. cmdKey                            EQU        $0100                ; Bit 0 of high byte 
  83. shiftKey                        EQU        $0200                ; Bit 1 of high byte 
  84. alphaLock                        EQU        $0400                ; Bit 2 of high byte 
  85. optionKey                        EQU        $0800                ; Bit 3 of high byte 
  86. controlKey                        EQU        $1000                ; Bit 4 of high byte 
  87. rightShiftKey                    EQU        $2000                ; Bit 5 of high byte 
  88. rightOptionKey                    EQU        $4000                ; Bit 6 of high byte 
  89. rightControlKey                    EQU        $8000                ; Bit 7 of high byte 
  90. activeFlagBit                    EQU        0                    ; activate? (activateEvt and mouseDown) 
  91. btnStateBit                        EQU        7                    ; state of button? 
  92. cmdKeyBit                        EQU        8                    ; command key down? 
  93. shiftKeyBit                        EQU        9                    ; shift key down? 
  94. alphaLockBit                    EQU        10                    ; alpha lock down? 
  95. optionKeyBit                    EQU        11                    ; option key down? 
  96. controlKeyBit                    EQU        12                    ; control key down? 
  97. rightShiftKeyBit                EQU        13                    ; right shift key down? 
  98. rightOptionKeyBit                EQU        14                    ; right Option key down? 
  99. rightControlKeyBit                EQU        15                    ; right Control key down? 
  100.  
  101. EventRecord             RECORD    0
  102. what                     ds.w   1        ; offset: $0 (0)
  103. message                     ds.l   1        ; offset: $2 (2)
  104. when                     ds.l   1        ; offset: $6 (6)
  105. where                     ds     Point    ; offset: $A (10)
  106. modifiers                 ds.w   1        ; offset: $E (14)
  107. sizeof                     EQU *            ; size:   $10 (16)
  108.                         ENDR
  109.  
  110. ; typedef struct EventRecord  EventRecord
  111. KeyMap                     RECORD    0
  112. map                         ds.b   16        ; offset: $0 (0)
  113. sizeof                     EQU *            ; size:   $10 (16)
  114.                         ENDR
  115.  
  116. EvQEl                     RECORD    0
  117. qLink                     ds.l   1        ; offset: $0 (0)
  118. qType                     ds.w   1        ; offset: $4 (4)
  119. evtQWhat                 ds.w   1        ; offset: $6 (6)        ; this part is identical to the EventRecord as... 
  120. evtQMessage                 ds.l   1        ; offset: $8 (8)        ; defined above 
  121. evtQWhen                 ds.l   1        ; offset: $C (12)
  122. evtQWhere                 ds     Point    ; offset: $10 (16)
  123. evtQModifiers             ds.w   1        ; offset: $14 (20)
  124. sizeof                     EQU *            ; size:   $16 (22)
  125.                         ENDR
  126.  
  127. ; typedef struct EvQEl         EvQEl
  128. ; typedef EvQEl             *EvQElPtr
  129. ; typedef GetNextEventFilterUPP  GNEFilterUPP
  130. ;
  131. ; pascal UInt32 GetCaretTime(void)
  132. ;
  133.     IF ¬ GENERATINGCFM THEN
  134.         Macro
  135.         _GetCaretTime         &dest=(sp)
  136.         move.l               $02F4,&dest
  137.         EndM
  138.     ELSE
  139.         IMPORT_CFM_FUNCTION    GetCaretTime
  140.     ENDIF
  141.  
  142. ;
  143. ; pascal void SetEventMask(EventMask value)
  144. ;
  145.     IF ¬ GENERATINGCFM THEN
  146.         Macro
  147.         _SetEventMask         &src=(sp)+
  148.         move.w               &src,$0144
  149.         EndM
  150.     ELSE
  151.         IMPORT_CFM_FUNCTION    SetEventMask
  152.     ENDIF
  153.  
  154. ;
  155. ; pascal EventMask GetEventMask(void)
  156. ;
  157.     IF ¬ GENERATINGCFM THEN
  158.         Macro
  159.         _GetEventMask         &dest=(sp)
  160.         move.w               $0144,&dest
  161.         EndM
  162.     ELSE
  163.         IMPORT_CFM_FUNCTION    GetEventMask
  164.     ENDIF
  165.  
  166. ;
  167. ; pascal QHdrPtr GetEvQHdr(void)
  168. ;
  169.     IF ¬ GENERATINGCFM THEN
  170.         Macro
  171.         _GetEvQHdr
  172.             dc.w     $2EBC
  173.             dc.w     $0000
  174.             dc.w     $014A
  175.         EndM
  176.     ELSE
  177.         IMPORT_CFM_FUNCTION    GetEvQHdr
  178.     ENDIF
  179.  
  180. ; InterfaceLib exports GetEvQHdr, so make GetEventQueue map to that 
  181. ;
  182. ; pascal UInt32 GetDblTime(void)
  183. ;
  184.     IF ¬ GENERATINGCFM THEN
  185.         Macro
  186.         _GetDblTime         &dest=(sp)
  187.         move.l               $02F0,&dest
  188.         EndM
  189.     ELSE
  190.         IMPORT_CFM_FUNCTION    GetDblTime
  191.     ENDIF
  192.  
  193. ; InterfaceLib exports GetDblTime, so make GetDoubleClickTime map to that 
  194. ;
  195. ; pascal Boolean GetNextEvent(EventMask eventMask, EventRecord *theEvent)
  196. ;
  197.     IF ¬ GENERATINGCFM THEN
  198.         _GetNextEvent:    OPWORD    $A970
  199.     ELSE
  200.         IMPORT_CFM_FUNCTION    GetNextEvent
  201.     ENDIF
  202.  
  203. ;
  204. ; pascal Boolean WaitNextEvent(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  205. ;
  206.     IF ¬ GENERATINGCFM THEN
  207.         _WaitNextEvent:    OPWORD    $A860
  208.     ELSE
  209.         IMPORT_CFM_FUNCTION    WaitNextEvent
  210.     ENDIF
  211.  
  212. ;
  213. ; pascal Boolean EventAvail(EventMask eventMask, EventRecord *theEvent)
  214. ;
  215.     IF ¬ GENERATINGCFM THEN
  216.         _EventAvail:    OPWORD    $A971
  217.     ELSE
  218.         IMPORT_CFM_FUNCTION    EventAvail
  219.     ENDIF
  220.  
  221. ;
  222. ; pascal void GetMouse(Point *mouseLoc)
  223. ;
  224.     IF ¬ GENERATINGCFM THEN
  225.         _GetMouse:    OPWORD    $A972
  226.     ELSE
  227.         IMPORT_CFM_FUNCTION    GetMouse
  228.     ENDIF
  229.  
  230. ;
  231. ; pascal Boolean Button(void)
  232. ;
  233.     IF ¬ GENERATINGCFM THEN
  234.         _Button:    OPWORD    $A974
  235.     ELSE
  236.         IMPORT_CFM_FUNCTION    Button
  237.     ENDIF
  238.  
  239. ;
  240. ; pascal Boolean StillDown(void)
  241. ;
  242.     IF ¬ GENERATINGCFM THEN
  243.         _StillDown:    OPWORD    $A973
  244.     ELSE
  245.         IMPORT_CFM_FUNCTION    StillDown
  246.     ENDIF
  247.  
  248. ;
  249. ; pascal Boolean WaitMouseUp(void)
  250. ;
  251.     IF ¬ GENERATINGCFM THEN
  252.         _WaitMouseUp:    OPWORD    $A977
  253.     ELSE
  254.         IMPORT_CFM_FUNCTION    WaitMouseUp
  255.     ENDIF
  256.  
  257. ;
  258. ; pascal void GetKeys(KeyMap theKeys)
  259. ;
  260.     IF ¬ GENERATINGCFM THEN
  261.         _GetKeys:    OPWORD    $A976
  262.     ELSE
  263.         IMPORT_CFM_FUNCTION    GetKeys
  264.     ENDIF
  265.  
  266. ;
  267. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  268. ;
  269.     IF ¬ GENERATINGCFM THEN
  270.         _KeyTranslate:    OPWORD    $A9C3
  271.     ELSE
  272.         IMPORT_CFM_FUNCTION    KeyTranslate
  273.     ENDIF
  274.  
  275. ;
  276. ; pascal UInt32 TickCount(void)
  277. ;
  278.     IF ¬ GENERATINGCFM THEN
  279.         _TickCount:    OPWORD    $A975
  280.     ELSE
  281.         IMPORT_CFM_FUNCTION    TickCount
  282.     ENDIF
  283.  
  284. ;
  285. ; pascal OSErr PostEvent(EventKind eventNum, UInt32 eventMsg)
  286. ;
  287.     IF ¬ GENERATINGCFM THEN
  288.         ; parameters: 
  289.         ;     eventNum          => A0
  290.         ;     eventMsg          => D0
  291.         ; returns: 
  292.         ;     OSErr             <= D0
  293.         _PostEvent:    OPWORD    $A02F
  294.     ELSE
  295.         IMPORT_CFM_FUNCTION    PostEvent
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal OSErr PPostEvent(EventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  300. ;
  301.     IF ¬ GENERATINGCFM THEN
  302.         _PPostEvent:    OPWORD    $A12F
  303.     ELSE
  304.         IMPORT_CFM_FUNCTION    PPostEvent
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal Boolean OSEventAvail(EventMask mask, EventRecord *theEvent)
  309. ;
  310.     IF ¬ GENERATINGCFM THEN
  311.         _OSEventAvail:    OPWORD    $A030
  312.     ELSE
  313.         IMPORT_CFM_FUNCTION    OSEventAvail
  314.     ENDIF
  315.  
  316. ;
  317. ; pascal Boolean GetOSEvent(EventMask mask, EventRecord *theEvent)
  318. ;
  319.     IF ¬ GENERATINGCFM THEN
  320.         _GetOSEvent:    OPWORD    $A031
  321.     ELSE
  322.         IMPORT_CFM_FUNCTION    GetOSEvent
  323.     ENDIF
  324.  
  325. ;
  326. ; pascal void FlushEvents(EventMask whichMask, EventMask stopMask)
  327. ;
  328.     IF ¬ GENERATINGCFM THEN
  329.         _FlushEvents:    OPWORD    $A032
  330.     ELSE
  331.         IMPORT_CFM_FUNCTION    FlushEvents
  332.     ENDIF
  333.  
  334. ;
  335. ; pascal void SystemClick(const EventRecord *theEvent, WindowPtr theWindow)
  336. ;
  337.     IF ¬ GENERATINGCFM THEN
  338.         _SystemClick:    OPWORD    $A9B3
  339.     ELSE
  340.         IMPORT_CFM_FUNCTION    SystemClick
  341.     ENDIF
  342.  
  343. ;
  344. ; pascal void SystemTask(void)
  345. ;
  346.     IF ¬ GENERATINGCFM THEN
  347.         _SystemTask:    OPWORD    $A9B4
  348.     ELSE
  349.         IMPORT_CFM_FUNCTION    SystemTask
  350.     ENDIF
  351.  
  352. ;
  353. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  354. ;
  355.     IF ¬ GENERATINGCFM THEN
  356.         _SystemEvent:    OPWORD    $A9B2
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION    SystemEvent
  359.     ENDIF
  360.  
  361.     IF OLDROUTINENAMES  THEN
  362.  
  363. networkEvt                        EQU        10
  364. driverEvt                        EQU        11
  365. app1Evt                            EQU        12
  366. app2Evt                            EQU        13
  367. app3Evt                            EQU        14
  368. app4Evt                            EQU        15
  369. networkMask                        EQU        $0400
  370. driverMask                        EQU        $0800
  371. app1Mask                        EQU        $1000
  372. app2Mask                        EQU        $2000
  373. app3Mask                        EQU        $4000
  374. app4Mask                        EQU        $8000
  375.  
  376.     ENDIF
  377.     ENDIF ; __EVENTS__
  378.